package com.mdxl.dao.note;

import com.mdxl.Entity.Account;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * Created by chengjian on 2017/9/12.
 */
@Repository
public interface MbAccountDao {
    @Insert({
            "insert into account (name,money)",
            "values (#{name},#{money})"
    })
    int insertAccount(Account account);
    @Delete({
            "delete from account where id =#{id}"
    })
    int deleteAccount(@Param("id")int id);
    @Update({
            "update account set name =#{name},money=#{money} where id =#{id}"
    })
    int updateAccount(Account account);
    @Select({
            "select * from account where id =#{id}"
    })
    @Results({
            @Result(property = "name", column = "name"),
            @Result(property = "id", column = "id"),
            @Result(property = "money", column = "money")
    })
    Account getAccount(@Param("id")String name);
    @Select({
            "select * from account "
    })
    @Results({
            @Result(property = "name", column = "name"),
            @Result(property = "id", column = "id"),
            @Result(property = "money", column = "money")
    })
    List<Account> getAllAcc();
}
